import request from '@/utils/request'

// 企业信息
export function getCompanyInfo() {
  return request({
    url: '/Companymation/selectCom.do',
    method: 'get'
  })
}

// 添加or修改企业信息
export function setCompanyInfo(data) {
  return request({
    url: '/Companymation/updateCom.do ',
    method: 'post',
    data
  })
}

// 制程增删改查
export function getProcess() {
  return request({
    url: '/region/getAllRegion.do',
    method: 'get'
  })
}
export function updataProcess(data) {
  return request({
    url: '/region/updateRegion.do',
    method: 'post',
    data
  })
}
export function addProcess(data) {
  return request({
    url: '/region/insertRegion.do',
    method: 'post',
    data
  })
}
export function deleteProcess(data) {
  return request({
    url: '/region/deleteRegion.do',
    method: 'post',
    data
  })
}

// 产线增删改查
// 所有产线
export function getAllLine() {
  return request({
    url: '/lineNew/selectAllLine.do',
    method: 'get'
  })
}
export function getLineByProcess(data) {
  return request({
    url: '/lineNew/selectAllLineByRegionId.do',
    method: 'get',
    params: { ...data }
  })
}
export function updataLine(data) {
  return request({
    url: '/lineNew/updateLine.do',
    method: 'post',
    data
  })
}
export function addLine(data) {
  return request({
    url: '/lineNew/insertLine.do',
    method: 'post',
    data
  })
}
export function deleteLine(data) {
  return request({
    url: '/lineNew/deleteLine.do',
    method: 'post',
    data
  })
}

// 槽段增删改查
// 所有槽位
export function getAllSlot() {
  return request({
    url: '/slotNew/selectAllSlot.do',
    method: 'get'
  })
}
export function getSlotByLine(data) {
  return request({
    url: '/slotNew/selectSlotByLineId.do',
    method: 'get',
    params: { ...data }
  })
}
export function updataSlot(data) {
  return request({
    url: '/slotNew/updateSlot.do',
    method: 'post',
    data
  })
}
export function addSlots(data) {
  return request({
    url: '/slotNew/insertSlot.do',
    method: 'post',
    data
  })
}
export function deleteSlot(data) {
  return request({
    url: '/slotNew/deleteSlot.do',
    method: 'post',
    data
  })
}

// 仪表增删改查
// 所有仪表
export function getAllDevice() {
  return request({
    url: '/deviceInfoNew/selectAllDeviceInfo.do',
    method: 'get'
  })
}
export function getDeviceBySlot(data) {
  return request({
    url: '/deviceInfoNew/queryDeviceInfoById.do',
    method: 'get',
    params: { ...data }
  })
}
export function updataDevice(data) {
  return request({
    url: '/deviceInfoNew/updateDeviceInfo.do',
    method: 'post',
    data
  })
}
export function addDevice(data) {
  return request({
    url: '/deviceInfoNew/insertDeviceInfo.do',
    method: 'post',
    data
  })
}
export function deleteDevice(data) {
  return request({
    url: '/deviceInfoNew/deleteDeviceInfo.do',
    method: 'post',
    data
  })
}

// 制程配置预览 ———— tree结构
export function getAllList() {
  return request({
    url: '/deviceInfoNew/getAll.do',
    method: 'get'
  })
}

// 以下： 功能模块配置
// 查所有制程的功能模块
export function getConfigAll() {
  return request({
    url: '/config/getAllConfig.do',
    method: 'get'
  })
}
export function getConfigByRegionId(data) {
  return request({
    url: '/config/getConfigByRegionId.do',
    method: 'get',
    params: { ...data }
  })
}
export function deleteConfig(data) {
  return request({
    url: '/config/deleteConfig.do',
    method: 'get',
    params: data
  })
}
export function insertConfig(data) {
  return request({
    url: '/config/insertConfig.do',
    method: 'post',
    data
  })
}
export function updateConfig(data) {
  return request({
    url: '/config/updateConfig.do',
    method: 'post',
    data
  })
}
